{include file="public/header" /}
<body>
<div class="layui-tab layui-tab-brief main-tab-container">
    <ul class="layui-tab-title main-tab-title">
        <div class="main-tab-item">信息修改</div>
    </ul>
    <div class="layui-tab-content">
        <form class="layui-form" onsubmit="return false;">
            <div class="layui-tab-item layui-show">
                {volist name="admin" id="vo"}
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-inline input-custom-width" style="width: 120px;height: 30px;border: 0px">
                        <span style="line-height : 40px;">{$vo.username}</span>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="password" name="password" value="" lay-verify="required" autocomplete="off" placeholder="请输入密码" class="layui-input">
                    </div>
                </div>
                {/volist}
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="admin_edit" type="button" id="admin_edit">立即修改</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        //按钮单击时执行
        $("#admin_edit").click(function(){
            $.ajax({
                url: "{:url('admin/edit')}",
                data: $("form").serialize(),
                type: "POST",
                datatype:"json",
                success: function( result ) {
                    layer.open({
                        title: '信息'
                        ,content: '修改成功！'
                    });
                    if(result.status == 'y'){
                        location.href='/admin/index';
                    }
                }
            });
        });
    });
</script>
<script type="text/javascript">
    layui.use(['element', 'form', 'upload', 'layedit', 'laydate'], function(){
        var element = layui.element()
            ,form = layui.form()
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,jq = layui.jquery;

        //创建一个编辑器
        var content = layedit.build('content',{
            uploadImage: { url: '' ,type: 'post'  }
            ,height: 200
        });
        //创建一个编辑器
        var reply = layedit.build('reply',{
            uploadImage: { url: '' ,type: 'post'  }
            ,height: 150
        });
        //表单验证
        form.verify({
            //编辑器数据同步
            layedit: function(value){
                layedit.sync(content);
                layedit.sync(reply);
            }
        });


    })
</script>
</body>
</html>